package com.yinhaochuan.tool;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;

public class FileText {
	
	public static String getText(File f){
		StringBuffer sb = new StringBuffer("");
		try {
			FileReader fr = new FileReader(f);
			BufferedReader br = new BufferedReader(fr);
			
			String s  = br.readLine();
			while (s!=null) {
				sb.append(s);
				s = br.readLine();
			}
			br.close();
		} catch (Exception e) {
			e.printStackTrace();
		}
		return sb.toString();
	}
	
	public static String getText(String s){
		String t = "";
		File f = new File(s);
		t = getText(f);
		return t;
	}

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub

	}

}
